package org.hawk.gwtppc.webtest.tests.classsuite;

import java.lang.reflect.Modifier;

import org.hawk.gwtppc.webtest.common.Asserts;
import org.hawk.gwtppc.webtest.common.Test;
import org.hawk.gwtppc.webtest.tests.mock.AnnotationMock;
import org.hawk.gwtppc.webtest.tests.mock.ClassMock;
import org.hawk.gwtppc.webtest.tests.mock.EnumMock;
import org.hawk.gwtppc.webtest.tests.mock.InterfaceMock;
import org.hawk.gwtppc.webtest.tests.mock.SubClassMock1;
import org.hawk.gwtppc.webtest.tests.mock.SubClassMock2;

public class GetDeclaredConstructorsTest implements Test {

	public void run() throws Throwable {
		Asserts.assertEquals(AnnotationMock.class.getDeclaredConstructors().length, 0);
		Asserts.assertEquals(InterfaceMock.class.getDeclaredConstructors().length, 0);
		Asserts.assertEquals(EnumMock.class.getDeclaredConstructors().length, 1);
		Asserts.assertEquals(ClassMock[].class.getDeclaredConstructors().length, 0);
		Asserts.assertEquals(ClassMock.class.getDeclaredConstructors().length, 1);
		Asserts.assertEquals(ClassMock.class.getDeclaredConstructors()[0].toString(), "public org.hawk.gwtppc.webtest.tests.mock.ClassMock()");
		Asserts.assertEquals(ClassMock.class.getDeclaredConstructors()[0].getModifiers(), Modifier.PUBLIC);
		Asserts.assertEquals(SubClassMock1.class.getDeclaredConstructors().length, 1);
		Asserts.assertEquals(SubClassMock1.class.getDeclaredConstructors()[0].toString(), "public org.hawk.gwtppc.webtest.tests.mock.SubClassMock1()");
		Asserts.assertEquals(SubClassMock1.class.getDeclaredConstructors()[0].getModifiers(), Modifier.PUBLIC);
		Asserts.assertEquals(SubClassMock2.class.getDeclaredConstructors().length, 4);
		Asserts.assertEquals(SubClassMock2.class.getDeclaredConstructors()[0].toString(), "public org.hawk.gwtppc.webtest.tests.mock.SubClassMock2(java.lang.String)");
		Asserts.assertEquals(SubClassMock2.class.getDeclaredConstructors()[0].getModifiers(), Modifier.PUBLIC);
		Asserts.assertEquals(SubClassMock2.class.getDeclaredConstructors()[1].toString(), "public org.hawk.gwtppc.webtest.tests.mock.SubClassMock2(int)");
		Asserts.assertEquals(SubClassMock2.class.getDeclaredConstructors()[1].getModifiers(), Modifier.PUBLIC);
		Asserts.assertEquals(SubClassMock2.class.getDeclaredConstructors()[2].toString(), "protected org.hawk.gwtppc.webtest.tests.mock.SubClassMock2(boolean)");
		Asserts.assertEquals(SubClassMock2.class.getDeclaredConstructors()[2].getModifiers(), Modifier.PROTECTED);
		Asserts.assertEquals(SubClassMock2.class.getDeclaredConstructors()[3].toString(), "private org.hawk.gwtppc.webtest.tests.mock.SubClassMock2(org.hawk.gwtppc.webtest.tests.mock.ClassMock,boolean)");
		Asserts.assertEquals(SubClassMock2.class.getDeclaredConstructors()[3].getModifiers(), Modifier.PRIVATE);
	}

	public String getName() {
		return "getDeclaredConstructors()";
	}

}
